home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / GNU / emacs.inst / emacs19.idb / usr / gnu / lib / emacs / site-lisp / gnus-mouse.el.z / gnus-mouse.el
Encoding:
Text File  |  1994-08-02  |  10.2 KB  |  208 lines

  1. ;;; gnus-mouse.el - Rick Frankel (rfrankel@us.oracle.com)
  2. ;;; this file adds emacs-19 mouse support to gnus news reading.
  3. ;;; in addition it defines a couple of other utility functions for use with
  4. ;;; gnus news reading, and addes a menu called News
  5. ;;; to the menu bar in summary and newsgroup modes.
  6.  
  7. ;;; this file was created for personal use, and is releases AS IS, with no
  8. ;;; warranty due to some requests seen on the net.
  9.  
  10. ;;; Basic Usage:
  11. ;;; In Newsgroup mode:
  12. ;;;   mouse-1    move to line at mouse (no action)
  13. ;;;   mouse-2    select newsgroup at mouse
  14. ;;;   mouse-3    catchup newsgroup at mouse
  15. ;;; In Summary mode:
  16. ;;;   mouse-1    move to line at mouse (no action)
  17. ;;;   mouse-2    select article at mouse
  18. ;;;   mouse-3    mark article at mouse as read.
  19. ;;;   O          save articles with same subject in file
  20. ;;;   M-C        catchup-to-here (see below)
  21.  
  22. ;;; In summary mode try:
  23. ;;;   mouse-1 on article and menu(News) catchup-to-here.
  24. ;;; this will mark all article from the beginning of the buffer as read
  25.  
  26. ;;; Bugs:
  27. ;;;  probably many, but the most obvious is that the News menus are sorted in
  28. ;;;  reverse alphabetical order.
  29.  
  30. (require 'gnus)
  31.  
  32. (defun gnus-summary-save-same-in-file (filename)
  33.   "Save articles with same subject \(in article # order\) in FILENAME"
  34.   (interactive "FFile: ")
  35.   (setq filename (expand-file-name filename))
  36.   (let ((count 1) (subject (gnus-summary-subject-string)))
  37.     (save-excursion
  38.       (gnus-summary-save-in-file filename)
  39.       (gnus-summary-mark-as-read nil "S")
  40.       (while (and subject
  41.                   (gnus-summary-search-forward nil subject))
  42.         (gnus-summary-save-in-file filename)
  43.         (gnus-summary-mark-as-read nil "S")
  44.         (setq count (1+ count)))
  45.       (gnus-summary-expand-window)
  46.       (message "%d articles saved in %s" count filename)))
  47. )
  48. (defun gnus-summary-catchup-to-here ()
  49.   "Mark articles from beginning of current summary buffer to point as read."
  50.   (interactive)
  51.   (beginning-of-line)
  52.   (let ((current (gnus-summary-article-number)))
  53.     (beginning-of-buffer)
  54.     (while (not (= (gnus-summary-article-number) current))
  55.       (gnus-summary-mark-as-read)
  56.       (gnus-summary-next-subject 1)
  57. )))
  58. (define-key gnus-summary-mode-map "O" 'gnus-summary-save-same-in-file)
  59. (define-key gnus-summary-mode-map "\ec" 'gnus-summary-catchup-to-here)
  60. (defun gnus-set-menus ()
  61. ;;
  62. ;; first the group mode menu
  63. ;;
  64.   (define-key gnus-group-mode-map [menu-bar newsgroup]
  65.     (cons "News" (make-sparse-keymap "newsgroup")))
  66.   (define-key gnus-group-mode-map [menu-bar newsgroup catchup]
  67.     '("catchup" . gnus-group-catchup))
  68.   (define-key gnus-group-mode-map [menu-bar newsgroup edit-global-kill]
  69.     '("edit-global-kill" . gnus-group-edit-global-kill))
  70.   (define-key gnus-group-mode-map [menu-bar newsgroup exit]
  71.     '("exit" . gnus-group-exit))
  72.   (define-key gnus-group-mode-map [menu-bar newsgroup force-update]
  73.     '("force-update" . gnus-group-force-update))
  74.   (define-key gnus-group-mode-map [menu-bar newsgroup get-new-news]
  75.     '("get-new-news" . gnus-group-get-new-news))
  76.   (define-key gnus-group-mode-map [menu-bar newsgroup group-name]
  77.     '("group-name" . gnus-group-group-name))
  78.   (define-key gnus-group-mode-map [menu-bar newsgroup jump-to-group]
  79.     '("jump-to-group" . gnus-group-jump-to-group))
  80.   (define-key gnus-group-mode-map [menu-bar newsgroup kill-group]
  81.     '("kill-group" . gnus-group-kill-group))
  82.   (define-key gnus-group-mode-map [menu-bar newsgroup kill-region]
  83.     '("kill-region" . gnus-group-kill-region))
  84.   (define-key gnus-group-mode-map [menu-bar newsgroup list-all-groups]
  85.     '("list-all-groups" . gnus-group-list-all-groups))
  86.   (define-key gnus-group-mode-map [menu-bar newsgroup list-groups]
  87.     '("list-groups" . gnus-group-list-groups))
  88.   (define-key gnus-group-mode-map [menu-bar newsgroup quit]
  89.     '("quit" . gnus-group-quit))
  90.   (define-key gnus-group-mode-map [menu-bar newsgroup restart]
  91.     '("restart" . gnus-group-restart))
  92.   (define-key gnus-group-mode-map [menu-bar newsgroup suspend]
  93.     '("suspend" . gnus-group-suspend))
  94.   (define-key gnus-group-mode-map [menu-bar newsgroup unsub-current-group]
  95.     '("unsubscribe-current-group" . gnus-group-unsubscribe-current-group))
  96.   (define-key gnus-group-mode-map [menu-bar newsgroup yank-group]
  97.     '("yank-group" . gnus-group-yank-group))
  98. ;;
  99. ;; summary mode map additions
  100. ;;
  101.   (define-key gnus-summary-mode-map [menu-bar summary]
  102.     (cons "News" (make-sparse-keymap "news")))
  103.   (define-key gnus-summary-mode-map [menu-bar summary caesar-message]
  104.     '("caesar-message" . gnus-summary-caesar-message))
  105.   (define-key gnus-summary-mode-map [menu-bar summary cancel-article]
  106.     '("cancel-article" . gnus-summary-cancel-article))
  107.   (define-key gnus-summary-mode-map [menu-bar summary catchup-and-exit]
  108.     '("catchup-and-exit" . gnus-summary-catchup-and-exit))
  109.   (define-key gnus-summary-mode-map [menu-bar summary catchup-to-here]
  110.     '("catchup-to-here" . gnus-summary-catchup-to-here))
  111.   (define-key gnus-summary-mode-map [menu-bar summary clear-mark-backward]
  112.     '("clear-mark-backward" . gnus-summary-clear-mark-backward))
  113.   (define-key gnus-summary-mode-map [menu-bar summary clear-mark-forward]
  114.     '("clear-mark-forward" . gnus-summary-clear-mark-forward))
  115.   (define-key gnus-summary-mode-map [menu-bar summary delete-marked-as-read]
  116.     '("delete-marked-as-read" . gnus-summary-delete-marked-as-read))
  117.   (define-key gnus-summary-mode-map [menu-bar summary delete-marked-with]
  118.     '("delete-marked-with" . gnus-summary-delete-marked-with))
  119.   (define-key gnus-summary-mode-map [menu-bar summary down-thread]
  120.     '("down-thread" . gnus-summary-down-thread))
  121.   (define-key gnus-summary-mode-map [menu-bar summary edit-local-kill]
  122.     '("edit-local-kill" . gnus-summary-edit-local-kill))
  123.   (define-key gnus-summary-mode-map [menu-bar summary exit]
  124.     '("exit" . gnus-summary-exit))
  125.   (define-key gnus-summary-mode-map [menu-bar summary first-unread-article]
  126.     '("first-unread-article" . gnus-summary-first-unread-article))
  127.   (define-key gnus-summary-mode-map [menu-bar summary followup]
  128.     '("followup" . gnus-summary-followup))
  129.   (define-key gnus-summary-mode-map [menu-bar summary followup-with-original]
  130.     '("followup-with-original" . gnus-summary-followup-with-original))
  131.   (define-key gnus-summary-mode-map [menu-bar summary hide-all-threads]
  132.     '("hide-all-threads" . gnus-summary-hide-all-threads))
  133.   (define-key gnus-summary-mode-map [menu-bar summary hide-thread]
  134.     '("hide-thread" . gnus-summary-hide-thread))
  135.   (define-key gnus-summary-mode-map [menu-bar summary kill-same-subject]
  136.     '("kill-same-subject" . gnus-summary-kill-same-subject))
  137.   (define-key gnus-summary-mode-map [menu-bar summary kill-thread]
  138.     '("kill-thread" . gnus-summary-kill-thread))
  139.   (define-key gnus-summary-mode-map [menu-bar summary mark-as-read]
  140.     '("mark-as-read" . gnus-summary-mark-as-read))
  141.   (define-key gnus-summary-mode-map [menu-bar summary mark-as-unread]
  142.     '("mark-as-unread" . gnus-summary-mark-as-unread-forward))
  143.   (define-key gnus-summary-mode-map [menu-bar summary next-group]
  144.     '("next-group" . gnus-summary-next-group))
  145.   (define-key gnus-summary-mode-map [menu-bar summary next-thread]
  146.     '("next-thread" . gnus-summary-next-thread))
  147.   (define-key gnus-summary-mode-map [menu-bar summary next-unread-article]
  148.     '("next-unread-article" . gnus-summary-next-unread-article))
  149.   (define-key gnus-summary-mode-map [menu-bar summary next-unread-same-subject]
  150.     '("next-unread-same-subject" . gnus-summary-next-unread-same-subject))
  151.   (define-key gnus-summary-mode-map [menu-bar summary prev-group]
  152.     '("prev-group" . gnus-summary-prev-group))
  153.   (define-key gnus-summary-mode-map [menu-bar summary prev-same-subject]
  154.     '("prev-same-subject" . gnus-summary-prev-same-subject))
  155.   (define-key gnus-summary-mode-map [menu-bar summary quit]
  156.     '("quit" . gnus-summary-quit))
  157.   (define-key gnus-summary-mode-map [menu-bar summary reply]
  158.     '("reply" . gnus-summary-reply))
  159.   (define-key gnus-summary-mode-map [menu-bar summary reply-with-original]
  160.     '("reply-with-original" . gnus-summary-reply-with-original))
  161.   (define-key gnus-summary-mode-map [menu-bar summary save-article]
  162.     '("save-article" . gnus-summary-save-article))
  163.   (define-key gnus-summary-mode-map [menu-bar summary save-in-file]
  164.     '("save-in-file" . gnus-summary-save-in-file))
  165.   (define-key gnus-summary-mode-map [menu-bar summary save-same-in-file]
  166.     '("save-same-in-file" . gnus-summary-save-same-in-file))
  167.   (define-key gnus-summary-mode-map [menu-bar summary show-all-headers]
  168.     '("show-all-headers" . gnus-summary-show-all-headers))
  169.   (define-key gnus-summary-mode-map [menu-bar summary show-all-threads]
  170.     '("show-all-threads" . gnus-summary-show-all-threads))
  171.   (define-key gnus-summary-mode-map [menu-bar summary show-article]
  172.     '("show-article" . gnus-summary-show-article))
  173.   (define-key gnus-summary-mode-map [menu-bar summary show-thread]
  174.     '("show-thread" . gnus-summary-show-thread))
  175.   (define-key gnus-summary-mode-map [menu-bar summary sort-by-author]
  176.     '("sort-by-author" . gnus-summary-sort-by-author))
  177.   (define-key gnus-summary-mode-map [menu-bar summary sort-by-date]
  178.     '("sort-by-date" . gnus-summary-sort-by-date))
  179.   (define-key gnus-summary-mode-map [menu-bar summary sort-by-number]
  180.     '("sort-by-number" . gnus-summary-sort-by-number))
  181.   (define-key gnus-summary-mode-map [menu-bar summary sort-by-subject]
  182.     '("sort-by-subject" . gnus-summary-sort-by-subject))
  183.   (define-key gnus-summary-mode-map [menu-bar summary sort-summary]
  184.     '("sort-summary" . gnus-summary-sort-summary))
  185.   (define-key gnus-summary-mode-map [menu-bar summary toggle-header]
  186.     '("toggle-header" . gnus-summary-toggle-header))
  187.   (define-key gnus-summary-mode-map [menu-bar summary toggle-mime]
  188.     '("toggle-mime" . gnus-summary-toggle-mime))
  189.   (define-key gnus-summary-mode-map [menu-bar summary toggle-threads]
  190.     '("toggle-threads" . gnus-summary-toggle-threads))
  191.   (define-key gnus-summary-mode-map [menu-bar summary toggle-truncation]
  192.     '("toggle-truncation" . gnus-summary-toggle-truncation)))
  193.  
  194. ;; now bind the menus and keys...
  195.  
  196. (gnus-set-menus)
  197.  
  198. (define-key gnus-group-mode-map [mouse-2] 'gnus-group-read-group)
  199. (define-key gnus-group-mode-map [down-mouse-2] 'mouse-set-point)
  200. (define-key gnus-summary-mode-map [down-mouse-2] 'mouse-set-point)
  201. (define-key gnus-summary-mode-map [mouse-2] 'gnus-summary-show-article)
  202. (define-key gnus-summary-mode-map [down-mouse-3] 'mouse-set-point)
  203. (define-key gnus-summary-mode-map [mouse-3] 'gnus-summary-mark-as-read-forward)
  204. (define-key gnus-group-mode-map [down-mouse-3] 'mouse-set-point)
  205. (define-key gnus-group-mode-map [mouse-3] 'gnus-group-catchup)
  206.  
  207. ;;; end gnus-mouse.el
  208.